package com.arraylistdemo;

import java.util.*;

public class ArrayListReverTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Collections.addAll(list,"zhangsan","lisi","wangwu");
        Collections.reverse(list);   //反转集合
        System.out.println(list);

        List<Poker> list1 = new ArrayList<>();
        list1.add(new Poker("K",2));
        list1.add(new Poker("A",3));
        list1.add(new Poker("2",4));
        list1.add(new Poker("2",4));

        Set<Poker> set = new HashSet<>();
        for (Poker poker : list1) {
            set.add(poker);
        }



        int max = list1.get(0).getLevel();
        for (Poker poker : list1) {
            if (poker.getLevel() > max) {
                max = poker.getLevel();
            }
        }
        for (Poker poker : list1) {
            if (poker.getLevel().equals(max)) {
                System.out.println(poker);
            }
        }
        System.out.println(list1);
        System.out.println(set);





    }
}
